package com.example.demo.service.impl;

import com.example.demo.entity.VoicePlan;
import com.example.demo.mapper.VoicePlanMapper;
import com.example.demo.service.VoicePlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VoicePlanServiceImpl implements VoicePlanService {
    @Autowired
    VoicePlanMapper voicePlanMapper;

    //通过服务的种类来查询所有的服务信息
    public List<VoicePlan> getPlansByCategoryOrderByPriceAsc() {
        return voicePlanMapper.selectAllByCategory();
    }

    //通过服务id来返回单个的商品信息
    public VoicePlan getPlanById(int id) {
        return voicePlanMapper.selectAllByPlanId(id);
    }

    //获取服务时长
    public double getDuration(int id)
    {
        return voicePlanMapper.getServiceDurationById(id);
    }
}
